home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 687 / xsb / psychedelic / blank.c next >
C/C++ Source or Header  |  1995-03-18  |  2KB  |  88 lines

  1. #include "/xsb.h"
  2.  
  3. struct GfxBase *GfxBase;
  4. struct IntuitionBase *IntuitionBase;
  5.  
  6. #define rnd(x) (rand()%(x))
  7.  
  8. void srand(int);
  9. int rand(void);
  10.  
  11. struct XSBPref defpref;
  12. extern struct Custom __far custom;
  13.  
  14. void __saveds XSBBlankScreen(long signum,struct XSBInfo *xsbi)
  15. {
  16.     struct RastPort *rp;
  17.     struct ViewPort *vp;
  18.     struct Screen *scr;
  19.     struct timerequest *tr=xsbi->tr;
  20.     struct XSBPref *pref=xsbi->prefs;
  21.  
  22.     defpref.xsb_arg=10;
  23.     if(pref) defpref=*pref;
  24.  
  25.     srand(scr);
  26.     GfxBase=OldOpenLibrary("graphics.library");
  27.     IntuitionBase=OldOpenLibrary("intuition.library");
  28.  
  29.     if(scr=OpenScreenTags(0,SA_Width,320,SA_Height,256,
  30.         SA_DisplayID,LORES_KEY,
  31.         SA_Type,CUSTOMSCREEN|SCREENQUIET,
  32.         SA_Quiet,TRUE,
  33.         SA_Depth,4,
  34.         TAG_DONE))
  35.      {
  36.      custom.dmacon=(1<<5);
  37.      rp=&scr->RastPort;
  38.      vp=&scr->ViewPort;
  39.      while(!(SetSignal(0,signum)&signum)) {
  40.         SetRGB4(vp,rnd(15),rnd(15),rnd(15),rnd(15));
  41.         SetAPen(rp,rnd(15));
  42.         switch(rnd(7)) {
  43.             case 0:
  44.             case 1:
  45.             case 2: WritePixel(rp,rnd(320),rnd(256)); break;
  46.             case 3:
  47.             case 4: Move(rp,rnd(320),rnd(256)); Draw(rp,rnd(320),rnd(256)); break;
  48.             case 5: DrawEllipse(rp,90+rnd(140),60+rnd(80),3+rnd(83),3+rnd(52)); break;
  49.             case 6: RectFill(rp,rnd(160),rnd(128),160+rnd(320),128+rnd(128)); break;
  50.         } 
  51.         tr->tr_node.io_Command=TR_ADDREQUEST;
  52.         tr->tr_time.tv_secs=0;
  53.         tr->tr_time.tv_micro=defpref.xsb_arg*10;
  54.         DoIO(tr);
  55.      }
  56.      CloseScreen(scr);
  57.     }
  58.     CloseLibrary(GfxBase);
  59.     CloseLibrary(IntuitionBase);
  60. }
  61.  
  62. char * __saveds XSBGetID(void)
  63. {
  64.     return("XSB Psychedelic Blanker\n\nGives some more or less\nnice psychedelic effects.");
  65. }
  66. char *cyl[]={"Sel1","Sel2","Sel3","Sel4",0};
  67.  
  68. struct XSBPref defpref4;
  69. struct XSBPref defpref3;
  70. struct XSBPref defpref2;
  71. struct XSBPref defpref1;
  72.  
  73. struct XSBParams parm4={0,XSBP_STRING,"String:",0,0,0,&defpref4};
  74. struct XSBParams parm3={&parm4,XSBP_BOOL,"Checkbox:",0,0,0,&defpref3};
  75. struct XSBParams parm2={&parm3,XSBP_INTEGER,"Int:",0,0,0,&defpref2};
  76. struct XSBParams parm1={&parm2,XSBP_CYCLE,"Cycle:",cyl,0,0,&defpref1};
  77. struct XSBParams parm={&parm1,XSBP_SLIDER,"Speed:",0,1,99,&defpref};
  78.  
  79.  
  80. struct  XSBParams * __saveds XSBGetParams(void)
  81. {
  82.     defpref1.xsb_arg=2;
  83.     defpref2.xsb_arg=4242;
  84.     defpref3.xsb_arg=5;
  85.     strcpy(defpref4.xsb_string,"Teststring");
  86.     return(&parm);
  87. }
  88.